<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page import="java.util.*" %>
<%@ page import="model.*" %>
<!DOCTYPE HTML>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=1.0, user-scalable=no" />
	<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
	<link rel="stylesheet" href="css/questudy.css" />
	
	<script src="http://code.jquery.com/jquery.js"></script>
	<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
	<script>
	function makeQuest() {
		var msg = document.getElementById("message");
		if(document.getElementById("questTitle").value == "") {
			msg.innerHTML = "제목을 입력하세요";
			return;
		}
		else if(document.getElementById("content").value == "") {
			msg.innerHTML = "내용을 입력하세요";
			return;
		}
		else if(document.getElementById("expiredTime").value == "") {
			msg.innerHTML = "마감시간을 입력하세요";
			return;
		}
		else {
			document.makeQuestForm.submit();
		}
	}
	</script>
	
<title>Welcome to Questudy</title>
</head>
<%
	int studyId = ((Integer)request.getAttribute("studyId")).intValue();
%>
<body>
<div class="container">
	<jsp:include page="nav/nav_main.jsp"></jsp:include>
	<jsp:include page="nav/nav_study.jsp"></jsp:include>
	<div class="col-md-6 col-md-offset-3">
		<form method="post" name="makeQuestForm" action="ModifyAction.Quest?studyId=<%=studyId%>">
			<input type="text" class="form-control" name="title" id="questTitle" placeholder="quest Title">
			<textarea class="form-control" id="content" name="content" rows="10" ></textarea>
			<label for="expiredTime">퀘스트 마감일</label>
			<input type="date" class="form-control" name="expiredtime" id="expiredTime">
			<p class="text-center">
				<button type="button" class="btn btn-default" onclick="makeQuest()">퀘스트 생성하기</button>
			</p>
		</form>
		<p class="text-warning" id="message" ></p> 
	</div>
</div>
</body>
</html>